

#import "XMAppConfigViewModel.h"
#import "XMCOSConfigModel.h"


@implementation XMAppConfigViewModel

- (void)getAppConfigCompleteBlock:(YHCompleteBlock)completeBlock {
    NSMutableDictionary *paramDic = @{}.mutableCopy;
    [[YHNetworkManager sharedInstance] postWithUrl:@"api/auth/config"
                                        parameters:paramDic
                                     completeBlock:^(XMResponseTip *_Nonnull tip, id _Nullable result) {
                                         XMAppConfigModel *model = [XMAppConfigModel mj_objectWithKeyValues:result];
                                         kGlobalVariables.appConfig = model;
                                         completeBlock(tip, model);
                                     }];
}

- (void)getCOSConfigCompleteBlock:(YHCompleteBlock)completeBlock {
    NSMutableDictionary *paramDic = @{}.mutableCopy;
    [[YHNetworkManager sharedInstance] postWithUrl:@"api/auth/uploadPolicy"
                                        parameters:paramDic
                                     completeBlock:^(XMResponseTip *_Nonnull tip, id _Nullable result) {
                                         if (tip.success) {
                                             XMCOSConfigModel *model = [XMCOSConfigModel mj_objectWithKeyValues:result];
                                             completeBlock(tip, model);
                                         }
                                     }];
}

- (void)updateLocateCity:(NSString *)city
                province:(NSString *)province
               longitude:(NSString *)longitude
                latitude:(NSString *)latitude
           completeBlock:(YHCompleteBlock)completeBlock {
//    NSMutableDictionary *paramDic = @{
//        @"city": [NSString xm_stringNoNullWith:city],
//        @"province": [NSString xm_stringNoNullWith:province],
//        @"longitude": [NSString xm_stringNoNullWith:longitude],
//        @"latitude": [NSString xm_stringNoNullWith:latitude]
//    }
//                                        .mutableCopy;
//
//    [[YHNetworkManager sharedInstance] postWithUrl:kUpdateLocate
//                                        parameters:paramDic
//                                     completeBlock:^(YHResponseTip *_Nonnull tip, id _Nullable result) {
//                                         completeBlock(tip, result);
//                                     }];
}

@end
